import React, { Component } from 'react'
import { BrowserRouter, Switch, Route, Redirect } from 'react-router-dom'
import { connect } from 'react-redux'
import Login from '../views/Login/Login'
import Register from '../views/Register/Register'
import Home from '../views/Home/Home'
import BossList from '../views/BossList/BossList'
import DaShenList from '../views/DaShenList/DaShenList'
import News from '../views/News/News'
import Personal from '../views/Personal/Personal'
import Chat from '../views/Chat/Chat'

// 路由配置文件
class RouterCom extends Component {
   render() {
      return (
         <BrowserRouter>
            <Switch>
               <Route path="/login" component={Login} />
               <Route path="/register" component={Register} />
               <Route path="/home" component={Home} />
               <Route path="/laoban" component={BossList} />
               <Route path="/dashen" component={DaShenList} />
               <Route path="/news" component={News} />
               <Route path="/personal" component={Personal} />
               <Route path="/chat" component={Chat} />
               <Redirect to="/login" />
            </Switch>
         </BrowserRouter>
      )
   }
}
export default connect(
   state => ({ userInfo: state.user })
)(RouterCom)